export const actions = {
  addCart(context, payload) {
    return new Promise((resolve, reject) => {
      let oldProduct = context.state.cartList.find(item => item.iid === payload.iid)

      if (oldProduct) {
        context.commit('AddCounter', oldProduct)
        resolve('当前商品+1')
      } else {
        payload.count = 1
        context.commit('AddToCart', payload)
        resolve("添加了新的商品")
      }
    })
  }
}
